home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 30 / PC Gamer IT CD 30 1-2.iso / MOTS / GAMEDATA / RESOURCE / JKMRES.GOO / cog_weap_bryar_m.cog < prev    next >
Text File  |  1998-02-25  |  6KB  |  216 lines

  1. # Jedi Knight Missions Cog Script
  2. #
  3. # WEAP_BRYAR_M.COG
  4. #
  5. # WEAPON 2 Script - Bryar Pistol
  6. #
  7. # The trusty weapon of Kyle Katarn. This is actually an older modified rifle
  8. # that has been cut down to more of a pistol size. It is very accurate but
  9. # somewhat of a low power weapon. This weapon has only one type of fire.
  10. #
  11. # - Affected by MagSealed sectors/surfaces.
  12. #
  13. # [YB & CYW] + [RF]
  14. #
  15. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  16.  
  17.  
  18. symbols
  19.  
  20. model       povModel=bryv.3do                   local
  21. model       povModel_m=bryv_m.3do               local
  22. model       weaponMesh=bryg.3do                 local
  23.  
  24. keyframe    mountAnim=bryvmnt.key               local
  25. keyframe    dismountAnim=bryvdis.key            local
  26. keyframe    povfireAnim=bryvpst1.key            local
  27. keyframe    holsterAnim=kyhlstr.key             local
  28.  
  29. sound       outSound=pistout1.wav               local
  30. sound       mountSound=df_bry_ready.wav         local
  31. sound       dismountSound=PutWeaponAway01.wav   local
  32. sound       fireSound=pistol-1.wav              local
  33. sound            failSound=weapfail.wav                    local
  34.  
  35. template    projectileB=+swsparks                 local
  36. template    projectile=+bryarbolt               local
  37.  
  38. thing       player                              local
  39. thing       victim                              local
  40. thing       potential                           local
  41.  
  42. flex        dot                                 local
  43. flex        maxDot                              local
  44.  
  45. flex        fireWait=0.5                        local
  46. flex        holsterWait                         local
  47. flex        fireDelay=0.6                       local
  48. flex        powerBoost                          local
  49. flex        autoAimFOV=30                       local
  50. flex        autoAimMaxDist=5                    local
  51.  
  52. int         weaponIndex                         local
  53. int         trackID=-1                          local
  54. int         dummy=0                             local
  55. int         mode                                local
  56. int         holsterTrack                        local
  57.  
  58. message     activated
  59. message     deactivated
  60. message     selected
  61. message     deselected
  62. message     autoselect
  63. message     fire
  64. message     timer
  65.  
  66. end
  67.  
  68. # ========================================================================================
  69.  
  70. code
  71.  
  72. fire:
  73.    player = GetSourceRef();
  74.  
  75.    // Check that the player is still alive.
  76.    if(GetThingHealth(player) <= 0)
  77.    {
  78.       Return;
  79.    }
  80.  
  81.    // Check Ammo - If we are out, autoselect best weapon.
  82.    if(GetInv(player, 11) < 1.0)
  83.    {
  84.       PlaySoundThing(outSound, player, 1.0, -1.0, -1.0, 0x80);
  85.       if(GetAutoSwitch() & 1)
  86.          SelectWeapon(player, GetWeaponBin(AutoSelectWeapon(player, 1)));
  87.       Return;
  88.    }
  89.  
  90.     SendMessageEx(GetThingClassCog(GetLocalPlayerThing()), user1, 3, 0, 0, 0);
  91.  
  92.    SetPOVShake('0.0 -.003 0.0', '1.0 0.0 0.0', .05, 80.0);
  93.     if (GetInv(player, 93) > 0.0)
  94.     {
  95.         dummy = FireProjectile(player, projectileB, failSound, 8, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
  96.     }
  97.     else
  98.     {
  99.         dummy = FireProjectile(player, projectile, fireSound, 8, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
  100.     }
  101.    ChangeInv(player, 11, -1.0);
  102.    jkPlayPOVKey(player, povfireAnim, 1, 0x38);
  103.  
  104.    powerBoost = GetInv(player, 63);
  105.    ChangeFireRate(player, fireWait/powerBoost);
  106.  
  107.    Return;
  108.  
  109. # ........................................................................................
  110.  
  111. activated:
  112.    player = GetSourceRef();
  113.    mode = GetSenderRef();
  114.  
  115.     if (GetInv(player, 93) > 0.0)
  116.         SendMessageEx(GetThingClassCog(player), skill, 1100, 0, 0, 0);
  117.  
  118.    jkSetWaggle(player, '0.0 0.0 0.0', 0);
  119.    powerBoost = GetInv(player, 63);
  120.    ActivateWeapon( player, fireWait/powerBoost, mode );
  121.    Return;
  122.  
  123. # ........................................................................................
  124.  
  125. deactivated:
  126.    player = GetSourceRef();
  127.    mode = GetSenderRef();
  128.  
  129.    jkSetWaggle(player, '10.0 7.0 0.0', 350);
  130.    DeactivateWeapon( player, mode );
  131.    Return;
  132.  
  133. # ........................................................................................
  134.  
  135. selected:
  136.    player = GetSourceRef();
  137.  
  138.    // Setup the meshes and models.
  139.     if (GetInv(player, 67) == 0.0)
  140.         jkSetPOVModel(player, povModel);        // Kyle hand
  141.     else
  142.         jkSetPOVModel(player, povModel_m);    // Mara Hand
  143.    jkSetWeaponMesh(player, weaponMesh);
  144.    SetArmedMode(player, 1);
  145.  
  146.    // Play mounting sound.
  147.    PlayMode(player, 41);
  148.    PlaySoundThing(mountSound, player, 1.0, -1.0, -1.0, 0x80);
  149.  
  150.    // Play the animation (NOLOOP + UNIQUE + ENDPAUSE).
  151.    // The animation is held at the last frame after it is played.
  152.    trackID = jkPlayPOVKey(player, mountAnim, 0, 0x14);
  153.    jkSetWaggle(player, '10.0 7.0 0.0', 350);
  154.  
  155.    // Clear saber flags, and allow activation of the weapon
  156.    jkClearFlags(player, 0x5);
  157.    SetCurWeapon(player, 2);
  158.    SetMountWait(player, GetKeyLen(mountAnim));
  159.  
  160.    Return;
  161.  
  162. # ........................................................................................
  163.  
  164. deselected:
  165.    player = GetSourceRef();
  166.    weaponIndex = GetSenderRef();
  167.  
  168.    PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
  169.    jkPlayPOVKey(player, dismountAnim, 0, 18);
  170.  
  171.    holsterWait = GetKeyLen(holsterAnim);
  172.    SetMountWait(player, holsterWait);
  173.    holsterTrack = PlayKey(player, holsterAnim, 1, 0x4);
  174.    SetTimerEx(holsterWait, 2, 0.0, 0.0);
  175.    if (trackID != -1)
  176.    {
  177.       jkStopPOVKey(player, trackID, 0);
  178.       trackID = -1;
  179.    }
  180.    jkSetWaggle(player, '0.0 0.0 0.0', 0);
  181.  
  182.    Return;
  183.  
  184. # ........................................................................................
  185.  
  186. autoselect:
  187.    player = GetSourceRef();
  188.  
  189.    // If the player has the weapon
  190.    if(GetInv(player, 2) != 0.0)
  191.    {
  192.       // If the player has ammo
  193.       if(GetInv(player, 11) != 0.0)
  194.       {
  195.          ReturnEx(500.0);
  196.       }
  197.       else
  198.       {
  199.          ReturnEx(-1.0);
  200.       }
  201.    }
  202.    else
  203.    {
  204.       ReturnEx(-1.0);
  205.    }
  206.  
  207.    Return;
  208.  
  209. # ........................................................................................
  210.  
  211. timer:
  212.    StopKey(player, holsterTrack, 0.0);
  213.    Return;
  214.  
  215. end
  216.